fix(docs): re-root relative image paths in rendered docs#552
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughDas PR aktualisiert ChangesRelative Bildpfad-Umwurzelung
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Rendered AsciiDoc emits relative image paths (e.g. image::docs/workflow-diagram.svg → <img src="docs/workflow-diagram.svg">). Doc pages are served under clean URLs like /spec-driven-development/, so the browser resolves that against the route → /spec-driven-development/docs/... → 404; the workflow diagram silently went missing on the Spec-Driven Development pages (EN + DE). Prefix relative <img> sources with the site base after loading, matching the asset's real location (/Semantic-Anchors/docs/...). Absolute, protocol, data and hash URLs are left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
507dba6 to
2451c46
Compare
Problem
The workflow diagram is missing on the Spec-Driven Development pages (EN + DE):
https://llm-coding.github.io/Semantic-Anchors/spec-driven-development/docs/workflow-diagram.svg→ 404.The AsciiDoc source uses a relative image path (
image::docs/workflow-diagram.svg[...]), which renders to<img src="docs/workflow-diagram.svg">. Doc pages are served under clean URLs (/spec-driven-development/), so the browser resolves the relative path against the route →/spec-driven-development/docs/...→ 404. The asset actually lives at/Semantic-Anchors/docs/workflow-diagram.svg(HTTP 200).Fix
In
doc-page.js, after injecting the rendered HTML, prefix relative<img>sources with the site base (import.meta.env.BASE_URL), matching the existing link/details post-processing. Absolute,http(s):,data:and#sources are left untouched. This fixes every doc-page image, not just this one.Tests
New unit test: relative
docs/workflow-diagram.svgis re-rooted to${BASE_URL}docs/workflow-diagram.svg, while an externalhttps://…src is left unchanged. All doc-page tests pass; lint + prettier clean.Verification (preview build)
Spec-Driven Development page: the diagram
<img>now hassrc="/Semantic-Anchors/docs/workflow-diagram.svg",naturalWidth 1100, fetch HTTP 200 — renders correctly.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests